// 一级分类标题
import { useEffect, useState } from "react";
import { getTypeOnelist } from "../../tools/Ajax";
import "./goodlist.css";
import { Link } from "react-router-dom";

function Goodlist() {
  let [list, setList] = useState([]);
  useEffect(() => {
    getTypeOnelist().then((res) => {
      setList(res.data.slice(0, 9));
      console.log(2, setList);
    });
  }, []);
  return (
    <div className="goolist">
      <div className="topbox">
        <div className="smallbox">
          {
            list.map((item) => {
                return <Link className="child" to={'/type?type='+ item} key={item}>{item}</Link>;
            })
          }
        </div>
      </div>
    </div>
  );
}
export default Goodlist;
